Quaqua 4.4.7 2008-07-16

ch.randelshofer.quaqua.panther
Class QuaquaPantherFileChooserUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.FileChooserUI
          extended by javax.swing.plaf.basic.BasicFileChooserUI
              extended by ch.randelshofer.quaqua.panther.QuaquaPantherFileChooserUI

public class QuaquaPantherFileChooserUI
extends javax.swing.plaf.basic.BasicFileChooserUI

A replacement for the AquaFileChooserUI. Provides a column view similar to the one provided with the native Aqua user interface on Mac OS X 10.3 (Panther).

Version:
2.3.6 2008-05-01 Fixed NullPointerException in maybeApproveSelection method and doDirectoryChanged method.
2.3.5 2008-04-27 Don't call AliasFileSystemTreeModel.invalidatePath with null arguments.
2.3.4 2008-04-23 NullPointerException occured when sidebar contained an unresolvable alias.
2.3.3 2008-04-18 Approve button was not always enabled, when directory selection mode was selected.
2.3.2 2008-03-25 On clicks in the sidebar, check whether the file is traversable.
2.3.1 2008-02-13 Use JFileChooser.getCurrentDirectory to make relative paths absolute.
2.3 2008-02-10 The current directory was not shown, when JFileChosser.setCurrentDirectory was called.
2.2.1 2008-01-21 When a directory was changed on the JFileChooser, the UI did not always update its view.
2.2 2007-10-03 Added keystroke support by Bjorn Roche.
2.1 2006-12-23 Hardcode size of split pane only instead of hardcoding the size of the file chooser as a whole.
2.0 2006-09-23 Invalidate all cached user file names, if the FileView is changed of the JFileChooser. Create AliasFileSystemModel only after the FileSystemView and the FileView has been set on the JFileChooser. Make the behavior better match with the native file dialog in Tiger.
1.8 2006-09-21 DirectoryComboBox and sidebar select now the directory that was selected, and not the parent directory. Fixed "New Folder" button text.
1.7.1 2006-05-06 Labels are now directly retrieved from UIManager.
1.7 2006-04-08 Use BasicFileView when UIManager property FileChooser.speed is set to true.
1.6.6 2006-03-28 Update approve button state on text change in filename field.
1.6.5 2006-03-22 New folder was created in parent directory when a folder was selected.
1.6.4 2006-03-15 Couldn't save a new file.
1.6.3 2006-03-14 Name of non-existing file was not written into filename field.
1.6.2 2006-03-05 Approve button did not work properly for multiple selection. Disallow approval on double clicks on a directory.
1.6.1 2006-02-06 Take infos from AliasFileSystemTreeModel.Node instead of from File objects to reduce the amount of IO operations.
1.6 2005-11-26 SidebarRenderer retrieves file icons from the SidebarListModel.
1.5.2 2005-11-13 Don't change text of fileNameTextField, when it has focus.
1.5.1 2005-11-07 Get "Labels" resource bundle from UIManager.
1.5 2005-09-11 Celltips for browser added. Allways display horizontal scroll bar of JBrowser.
1.4.4 2005-08-25 Fixed a null pointer exception.
1.4.3 2005-06-21 SplitPane divider size configurable by LookAndFeel.
1.4.2 2005-06-05 Moved calls to System.getProperty into QuaquaManager.
1.4.1 2005-04-22 Tweaked the layout.
1.4 2005-03-22 Show as much path components as possible of non-existent files in the directory combo box. Use Locale.getDefault() in case the JFileChooser component can not provide a locale.
1.3.1 2004-12-28 Call clearIconCache() on the IconView, if this method is available.
1.3 2004-11-01 Support for dropping files on the file chooser added. File and directory selection is now handled in a more straightforward way - this may affect code that depends on the values returned by methods JFileChooser.getSelectedFiles(), JFileChooser.getSelectedFile() while the file chooser is being shown. 1.2.2 2004-10-26 setFileSelected had no effect, when a file with a relative path was used.
1.2.1 2004-10-21 Double clicking the browsers approves the selection. When there is an approvable selection, the approve button is made the default button.
1.2 2004-10-17 Resolve alias files. Do not clear fileName text field, when the user selects a directory. Volumes list did not update properly when a volume was added/removed. Handle relative path names. Display the real name of a file in the file name text field. Enable the approve button only, when the right kind of file (or directory) is selected. Treat non-traversable directories like files. Selecting a file in the volumes list, sets the current directory to that file. Fixed a bug where the file name in the file name field was used to determine the approved file altough the field was not visible.
1.1.2 2004-09-11 Fixed IndexOutOfBoundsException caused by method addItem of inner class DirectoryComboBoxModel. Replaced all method invocations to method QuaquaManager.getProperty to QuaquaManager.getProperty.
1.1.1 2004-08-28 Set the FileView of the JFileChooser.
1.1 2004-07-31 Set the text of the approve button to "Choose", when directory selection is enabled. Fixed layout issue with fileNameTextField. 1.0 2004-07-04 Created.
Author:
Werner Randelshofer

Nested Class Summary
protected  class QuaquaPantherFileChooserUI.BrowserSelectionListener
          Selection listener for the list of files and directories.
protected  class QuaquaPantherFileChooserUI.DirectoryComboBoxAction
          Acts when DirectoryComboBox has changed the selected item.
protected  class QuaquaPantherFileChooserUI.DirectoryComboBoxModel
          Data model for a directory selection combo-box.
protected  class QuaquaPantherFileChooserUI.DoubleClickListener
           
protected  class QuaquaPantherFileChooserUI.FilterComboBoxModel
          Data model for a type-face selection combo-box.
 class QuaquaPantherFileChooserUI.FilterComboBoxRenderer
          Render different type sizes and styles.
protected  class QuaquaPantherFileChooserUI.NewFolderAction
          Creates a new folder.
protected  class QuaquaPantherFileChooserUI.QuaquaApproveSelectionAction
          Responds to an Open or Save request
protected  class QuaquaPantherFileChooserUI.SaveTextDocumentListener
           
protected  class QuaquaPantherFileChooserUI.SaveTextFocusListener
           
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicFileChooserUI
javax.swing.plaf.basic.BasicFileChooserUI.AcceptAllFileFilter, javax.swing.plaf.basic.BasicFileChooserUI.ApproveSelectionAction, javax.swing.plaf.basic.BasicFileChooserUI.BasicFileView, javax.swing.plaf.basic.BasicFileChooserUI.CancelSelectionAction, javax.swing.plaf.basic.BasicFileChooserUI.ChangeToParentDirectoryAction, javax.swing.plaf.basic.BasicFileChooserUI.GoHomeAction, javax.swing.plaf.basic.BasicFileChooserUI.SelectionListener, javax.swing.plaf.basic.BasicFileChooserUI.UpdateAction
 
Field Summary
protected  java.lang.String chooseButtonText
           
 
Fields inherited from class javax.swing.plaf.basic.BasicFileChooserUI
cancelButtonMnemonic, cancelButtonText, cancelButtonToolTipText, computerIcon, detailsViewIcon, directoryIcon, directoryOpenButtonMnemonic, directoryOpenButtonText, directoryOpenButtonToolTipText, fileIcon, floppyDriveIcon, hardDriveIcon, helpButtonMnemonic, helpButtonText, helpButtonToolTipText, homeFolderIcon, listViewIcon, newFolderIcon, openButtonMnemonic, openButtonText, openButtonToolTipText, saveButtonMnemonic, saveButtonText, saveButtonToolTipText, updateButtonMnemonic, updateButtonText, updateButtonToolTipText, upFolderIcon
 
Constructor Summary
QuaquaPantherFileChooserUI(javax.swing.JFileChooser filechooser)
           
 
Method Summary
protected  void addControlButtons()
           
 void clearIconCache()
           
protected  javax.swing.event.AncestorListener createAncestorListener(javax.swing.JFileChooser fc)
          Creates an AncestorListener.
protected  javax.swing.event.TreeSelectionListener createBrowserSelectionListener(javax.swing.JFileChooser fc)
           
protected  QuaquaPantherFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(javax.swing.JFileChooser fc)
           
protected  ch.randelshofer.quaqua.panther.QuaquaPantherFileChooserUI.DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(javax.swing.JFileChooser fc)
           
protected  java.awt.event.MouseListener createDoubleClickListener(javax.swing.JFileChooser fc)
           
protected  QuaquaPantherFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()
           
protected  QuaquaPantherFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()
           
 void createModel()
           
 java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JFileChooser fc)
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
protected  ch.randelshofer.quaqua.panther.QuaquaPantherFileChooserUI.SidebarRenderer createVolumesRenderer(javax.swing.JFileChooser fc)
           
protected  javax.swing.event.ListSelectionListener createVolumesSelectionListener(javax.swing.JFileChooser fc)
           
 void ensureFileIsVisible(javax.swing.JFileChooser fc, java.io.File f)
          API method of FileChooserUI.
 javax.swing.JPanel getAccessoryPanel()
          FIXME - This could be moved up to BasicFileChooserUI.
protected  javax.swing.JButton getApproveButton(javax.swing.JFileChooser fc)
           
 java.lang.String getApproveButtonText(javax.swing.JFileChooser fc)
          API method of FileChooserUI.
 javax.swing.Action getApproveSelectionAction()
           
 java.lang.String getFileName()
           
 AliasFileSystemTreeModel getFileSystemTreeModel()
           
 javax.swing.filechooser.FileView getFileView(javax.swing.JFileChooser fc)
          API method of FileChooserUI.
 javax.swing.Action getNewFolderAction()
           
 SubtreeTreeModel getTreeModel()
           
 void installComponents(javax.swing.JFileChooser fc)
           
protected  void installListeners(javax.swing.JFileChooser fc)
          Installs listeners.
protected  void installStrings(javax.swing.JFileChooser fc)
           
protected  void removeControlButtons()
           
 void rescanCurrentDirectory(javax.swing.JFileChooser fc)
          API method of FileChooserUI.
 void setFileName(java.lang.String filename)
           
 void uninstallComponents(javax.swing.JFileChooser fc)
           
protected  void uninstallListeners(javax.swing.JFileChooser fc)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicFileChooserUI
createDoubleClickListener, createListSelectionListener, getAcceptAllFileFilter, getApproveButtonMnemonic, getApproveButtonToolTipText, getCancelSelectionAction, getChangeToParentDirectoryAction, getDialogTitle, getDirectory, getDirectoryName, getFileChooser, getGoHomeAction, getModel, getUpdateAction, installDefaults, installIcons, installUI, isDirectorySelected, setDirectory, setDirectoryName, setDirectorySelected, uninstallDefaults, uninstallIcons, uninstallStrings, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

chooseButtonText

protected java.lang.String chooseButtonText
Constructor Detail

QuaquaPantherFileChooserUI

public QuaquaPantherFileChooserUI(javax.swing.JFileChooser filechooser)
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

installComponents

public void installComponents(javax.swing.JFileChooser fc)
Overrides:
installComponents in class javax.swing.plaf.basic.BasicFileChooserUI

uninstallComponents

public void uninstallComponents(javax.swing.JFileChooser fc)
Overrides:
uninstallComponents in class javax.swing.plaf.basic.BasicFileChooserUI

installListeners

protected void installListeners(javax.swing.JFileChooser fc)
Installs listeners. We install the same listeners as BasicFileChooserUI plus an AncestorListener and a property change listener.

Overrides:
installListeners in class javax.swing.plaf.basic.BasicFileChooserUI

uninstallListeners

protected void uninstallListeners(javax.swing.JFileChooser fc)
Overrides:
uninstallListeners in class javax.swing.plaf.basic.BasicFileChooserUI

installStrings

protected void installStrings(javax.swing.JFileChooser fc)
Overrides:
installStrings in class javax.swing.plaf.basic.BasicFileChooserUI

getAccessoryPanel

public javax.swing.JPanel getAccessoryPanel()
FIXME - This could be moved up to BasicFileChooserUI.

Overrides:
getAccessoryPanel in class javax.swing.plaf.basic.BasicFileChooserUI

createAncestorListener

protected javax.swing.event.AncestorListener createAncestorListener(javax.swing.JFileChooser fc)
Creates an AncestorListener. The AncestorListener is used to take an action when the JFileChooser becomes showing on screen.


createModel

public void createModel()
Overrides:
createModel in class javax.swing.plaf.basic.BasicFileChooserUI

getTreeModel

public SubtreeTreeModel getTreeModel()

getFileSystemTreeModel

public AliasFileSystemTreeModel getFileSystemTreeModel()

createBrowserSelectionListener

protected javax.swing.event.TreeSelectionListener createBrowserSelectionListener(javax.swing.JFileChooser fc)

createPropertyChangeListener

public java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JFileChooser fc)
Overrides:
createPropertyChangeListener in class javax.swing.plaf.basic.BasicFileChooserUI

removeControlButtons

protected void removeControlButtons()

addControlButtons

protected void addControlButtons()

getFileName

public java.lang.String getFileName()
Overrides:
getFileName in class javax.swing.plaf.basic.BasicFileChooserUI

setFileName

public void setFileName(java.lang.String filename)
Overrides:
setFileName in class javax.swing.plaf.basic.BasicFileChooserUI

createDirectoryComboBoxRenderer

protected ch.randelshofer.quaqua.panther.QuaquaPantherFileChooserUI.DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(javax.swing.JFileChooser fc)

createVolumesRenderer

protected ch.randelshofer.quaqua.panther.QuaquaPantherFileChooserUI.SidebarRenderer createVolumesRenderer(javax.swing.JFileChooser fc)

createVolumesSelectionListener

protected javax.swing.event.ListSelectionListener createVolumesSelectionListener(javax.swing.JFileChooser fc)

createDirectoryComboBoxModel

protected QuaquaPantherFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(javax.swing.JFileChooser fc)

createFilterComboBoxRenderer

protected QuaquaPantherFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()

createFilterComboBoxModel

protected QuaquaPantherFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()

getApproveButton

protected javax.swing.JButton getApproveButton(javax.swing.JFileChooser fc)
Overrides:
getApproveButton in class javax.swing.plaf.basic.BasicFileChooserUI

getApproveSelectionAction

public javax.swing.Action getApproveSelectionAction()
Overrides:
getApproveSelectionAction in class javax.swing.plaf.basic.BasicFileChooserUI

getNewFolderAction

public javax.swing.Action getNewFolderAction()
Overrides:
getNewFolderAction in class javax.swing.plaf.basic.BasicFileChooserUI

ensureFileIsVisible

public void ensureFileIsVisible(javax.swing.JFileChooser fc,
                                java.io.File f)
API method of FileChooserUI.

Overrides:
ensureFileIsVisible in class javax.swing.plaf.basic.BasicFileChooserUI

getApproveButtonText

public java.lang.String getApproveButtonText(javax.swing.JFileChooser fc)
API method of FileChooserUI.

Overrides:
getApproveButtonText in class javax.swing.plaf.basic.BasicFileChooserUI

getFileView

public javax.swing.filechooser.FileView getFileView(javax.swing.JFileChooser fc)
API method of FileChooserUI.

Overrides:
getFileView in class javax.swing.plaf.basic.BasicFileChooserUI

rescanCurrentDirectory

public void rescanCurrentDirectory(javax.swing.JFileChooser fc)
API method of FileChooserUI.

Overrides:
rescanCurrentDirectory in class javax.swing.plaf.basic.BasicFileChooserUI

clearIconCache

public void clearIconCache()
Overrides:
clearIconCache in class javax.swing.plaf.basic.BasicFileChooserUI

createDoubleClickListener

protected java.awt.event.MouseListener createDoubleClickListener(javax.swing.JFileChooser fc)

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.